<h2>Favorites</h2>

<div id="quotes">
<?php
  $quotes = $pager->getResults();
  $quotes->populateRelation('QuoteHelper');
?>
  <?php foreach($quotes as $quote): ?>
    <p>
      <?php echo $quote->getContent() ?>
    </p>

    <a class="remove_fav" href="<?php echo url_for('profile/removeFavorite?quote_id='.$quote->getId()) ?>"></a>

    <a href="<?php echo url_for('author_show', $quote->getAuthor()) ?>">
      More from <?php echo $quote->getAuthor()->getName() ?> ...
    </a>

  <?php endforeach ?>

  <?php if ($pager->haveToPaginate()): ?>
    <div class="pagination">
      <a href="<?php echo url_for('profile_favorites').'?page=1' ?>">
        <img src="/images/first.png" alt="First page" title="First page" />
      </a>

      <a href="<?php echo url_for('profile_favorites').'?page='.$pager->getPreviousPage() ?>">
        <img src="/images/previous.png" alt="Previous page" title="Previous page" />
      </a>

      <?php if($pager->getPage() > 3): ?> ... <?php endif ?>

      <?php foreach ($pager->getLinks() as $page): ?>
        <?php if ($page == $pager->getPage()): ?>
          <?php echo $page ?>
        <?php else: ?>
          <a href="<?php echo url_for('profile_favorites').'?page='.$page ?>">
            <?php echo $page ?>
          </a>
        <?php endif ?>

      <?php endforeach ?>

      <?php if($pager->getLastPage() - $pager->getPage() > 3): ?> ... <?php endif ?>

      <a href="<?php echo url_for('profile_favorites').'?page='.$pager->getNextPage() ?>">
        <img src="/images/next.png" alt="Next page" title="Next page" />
      </a>

      <a href="<?php echo url_for('profile_favorites').'?page='.$pager->getLastPage() ?>">
        <img src="/images/last.png" alt="Last page" title="Last page" />
      </a>
    </div>
  <?php endif; ?>

  <div class="pagination_desc">
    <strong><?php echo count($pager) ?></strong> favorites

    <?php if ($pager->haveToPaginate()): ?>
      - page <strong><?php echo $pager->getPage() ?> of <?php echo $pager->getLastPage() ?></strong>
    <?php endif; ?>
  </div>
</div>
